cmake_minimum_required(VERSION 2.8.12)
project(controlModule)

set(CMAKE_CXX_STANDARD 11)
if(DEFINED CMAKE_SYSROOT AND NOT DEFINED CMAKE_C_COMPILER)
		set(CMAKE_C_COMPILER ${CMAKE_SYSROOT}/../../bin/arm-linux-gnueabihf-gcc)
endif()
if(DEFINED CMAKE_SYSROOT AND NOT DEFINED CMAKE_CXX_COMPILER)
		set(CMAKE_CXX_COMPILER ${CMAKE_SYSROOT}/../../bin/arm-linux-gnueabihf-g++)
endif()


#set(CMAKE_SYSROOT /home/onbrd/Git/A028/main/buildroot/bxyq/host/usr/arm-buildroot-linux-gnueabihf/sysroot)
set(PLATFORM_LIBS pthread dl python3.11)

find_package(PkgConfig REQUIRED)
pkg_check_modules(REQLIBS REQUIRED
        libcfgclient
        log4cpp
		libcurl
        )
pkg_check_modules(PYTHON REQUIRED python3)

include_directories(
        ${REQLIBS_INCLUDE_DIRS}
        ${CMAKE_SYSROOT}/usr/include
        ${CMAKE_SOURCE_DIR}/src
        ${PYTHON_INCLUDE_DIRS}

	src
	src/global
	src/utils
	src/fpgaControl
)

link_directories(
        ${REQLIBS_LIBRARY_DIRS}
        ${CMAKE_SYSROOT}/lib
        ${CMAKE_SYSROOT}/usr/lib
)

list(APPEND ALL_LIBS
        ${PLATFORM_LIBS}
        ${REQLIBS_LIBRARIES}
        ${PYTHON_LIBRARIES}
)

find_package(Boost REQUIRED COMPONENTS system date_time filesystem)

file(GLOB_RECURSE SRC_FILES "src/*.h" "src/*.cpp")

add_executable(${PROJECT_NAME} ${SRC_FILES})

target_link_libraries(${PROJECT_NAME} ${ALL_LIBS} ${Boost_LIBRARIES} fcgi xserng  cjson crypto ssl nl-3 wpa_client)
